#include "mainwindow.h"
#include "ui_mainwindow.h"

MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent), ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    move(500,200);

    connect(ui->slider_red, SIGNAL(valueChanged(int)),
        this, SLOT(on_slider_valueChanged()));
    connect(ui->slider_green, SIGNAL(valueChanged(int)),
        this, SLOT(on_slider_valueChanged()));
    connect(ui->slider_bule, SIGNAL(valueChanged(int)),
        this, SLOT(on_slider_valueChanged()));
    connect(ui->slider_ALPHA, SIGNAL(valueChanged(int)),
        this, SLOT(on_slider_valueChanged()));

}

MainWindow::~MainWindow()
{
    delete ui;
}

void MainWindow::on_slider_valueChanged()
{
    int red = ui->slider_red->value();
    int green = ui->slider_green->value();
    int bule = ui->slider_bule->value();
    int ALPHA = ui->slider_ALPHA->value();

    QColor myColor;
    myColor.setRgb(red,green,bule,ALPHA);

    QPalette pal;
    // pal = ui->edit_palette->palette();
    pal.setColor(QPalette::Base,myColor);
    ui->edit_palette->setPalette(pal);

}

void MainWindow::on_dial_sliderMoved(int position)
{
    int value = ui->dial->value();

    ui->progressBar->setValue(value);
    ui->lcdNumber->display(value);
}

